import React from 'react';
import { useLocation } from 'react-router-dom';

// 导入所有子模块
import ActivityManagement from './ActivityManagement';
import MyCreatedActivities from './MyCreatedActivities';
import MyActivities from './MyActivities';
import CheckinRecords from './CheckinRecords';

const Checkin = () => {
  const location = useLocation();
  const currentPath = location.pathname;

  // 根据当前路径渲染对应的组件
  const renderContent = () => {
    switch (currentPath) {
      case '/checkin/activity-management':
        return <ActivityManagement />;
      case '/checkin/my-created-activities':
        return <MyCreatedActivities />;
      case '/checkin/my-activities':
        return <MyActivities />;
      case '/checkin/records':
        return <CheckinRecords />;
      case '/checkin':
      default:
        // 默认显示活动管理页面
        return <ActivityManagement />;
    }
  };

  return (
    <div>
      {renderContent()}
    </div>
  );
};

export default Checkin; 